﻿using AgencyManagerSystem.Model;
using System.Collections.Generic;
using System.Linq;

namespace AgencyManagerSystem.DataFetcher
{
    public class BillFetcher : BaseFetcher<BillModel>
    {
        public BillFetcher() : base()
        {

        }
        public IList<BillModel> ListByRetail(int retail)
        {
            Condition[] conditions = new Condition[] { new Condition() { Key = "Retail", Op = "=", Value = retail } };
            var list = List(conditions);
            return list;
        }
        public BillModel GetByRetailAndPeriod(int retail, int year,int month)
        {
            Condition[] conditions = new Condition[] {
                new Condition() { Key = "Retail", Op = "=", Value = retail },
                new Condition() { Key = "Year", Op = "=", Value = year },
                new Condition() { Key = "Month", Op = "=", Value = month },
            };
            var list = List(conditions);
            if (list.Count > 0)
                return list.First();
            return null;
        }
    }
}

